<?php defined('_XR_EXEC') or die();
/**
 * path  class.
 *
 * 
 * by zhoupeng 2012-4-25
 *
 */
class path {
	var $floder = array();
	# 实例化自己
	public static function singleton()
	{
		static $instances;
		if (!isset ($instances))
		{
			$instances = new path();
		}
		return $instances;
	} 
	# 添加path
	public function add($s) {
		switch(gettype($s)){
			case 'array':
				foreach($s as $v){
					if(gettype($v) == 'string'){
						$arr_tmp = $this->floder;
						$arr_tmp[] = $v;
						$this->floder = $arr_tmp;
					}
				}
				break;
			case 'string':
				$arr_tmp = $this->floder;
				$arr_tmp[] = $s;
				$this->floder = $arr_tmp;
				break;
			default:
				return false;		
		}
		return true;
	}
	# 得到url路径 or 全路径
	public function get($bytype='array'){
		switch($bytype){
			case 'array':
				return $this->floder;
				break;
			case 'string':
				return implode(';',$this->floder);
				break;	
		}
	}
 

}

?>